**********************************************************************************************
* Reproduces Table 5
*
* Ajzenman, Elacqua, Jaimovich and Pérez-Núñez (2024)."Humans versus Chatbots: Scaling-up behavioral interventions to reduce teacher shortages"  	  		
*
**********************************************************************************************

///// Education Outcomes

*Preferences and enrollment in education programs. Human and bot effect, main results.
reg education_rankfirst i.grupo_gen education_preference sexo i.dependencia_colegio top_30,r
estadd ysumm 
outreg2 using "${output}/Table5.tex", replace sdec(4) tex  keep(i.grupo_gen)  addstat(Mean of dependent variable, e(ymean)) label nocons

foreach var in education_proportion education_listed d_enroll_education{
	
reg `var' i.grupo_gen education_preference sexo i.dependencia_colegio top_30,r
estadd ysumm 
outreg2 using "${output}/Table5.tex", append sdec(4) tex  keep(i.grupo_gen)  addstat(Mean of dependent variable, e(ymean)) label nocons
eststo clear
}

*Human vs Bot effect differences p-value
foreach var in education_rankfirst education_proportion education_listed d_enroll_education{
	
reg `var' i.grupo_gen education_preference sexo i.dependencia_colegio top_30,r
test 1.grupo_gen=2.grupo_gen	
}

*Multiple hypotesis
set seed 40813
rwolf education_rankfirst education_proportion education_listed d_enroll_education , indepvar(humano bot) method(reg) controls(education_preference sexo top_30 i.dependencia_colegio) r

*Note: Calculations of statistical significance with multiple hypotheses and the significant difference in the bot vs human effect were manually added to the table according to the results produced by the commands run earlier in this code.